$(document).ready(function(){
	
	//点击仓库跳转页面
	$(document).on("click",".WarehouseToArea",function(){
		var warehouseId=$(this).find(".left").find(".text").find(".aaa").find(".warehouseID").text();
		window.location.href="GoodsArea.html?warehouseId="+warehouseId+""
	})
	
	//仓库的货区数
	goodsAreaNum();
	
	function goodsAreaNum(){
		$.ajax({
			type: "get",
			url: "http://94.191.11.204/ynjt/api/dpjk/goodwarehouse/",
			dataType:"json",
			contentType:"application/json",
			success: function (data){
				console.log(data);

				//仓库名称
				var warehouseName = new Array();
				for (let j = 0; j < data.goods.length; j++) {
					warehouseName.push(data.goods[j].name);
				}
				$("#cangkuName1").text(warehouseName[0]);
				$("#cangkuName2").text(warehouseName[1]);
				$("#cangkuName3").text(warehouseName[2]);
				$("#cangkuName4").text(warehouseName[3]);
				$("#cangkuName5").text(warehouseName[4]);
				$("#cangkuName6").text(warehouseName[5]);
				$("#cangkuName7").text(warehouseName[6]);

				//仓库ID
				var warehouseID = new Array();
				for (let i = 0; i < data.goods.length; i++) {
					warehouseID.push(data.goods[i].id);
				}
				$("#warehouseID1").text(warehouseID[0]);
				$("#warehouseID2").text(warehouseID[1]);
				$("#warehouseID3").text(warehouseID[2]);
				$("#warehouseID4").text(warehouseID[3]);
				$("#warehouseID5").text(warehouseID[4]);
				$("#warehouseID6").text(warehouseID[5]);
				$("#warehouseID7").text(warehouseID[6]);



/*
				//仓库货区数
				var warehouse1 = 0;
				var warehouse2 = 0;
				var warehouse3 = 0;
				var warehouse4 = 0;
				var warehouse5 = 0;
				var warehouse6 = 0;
				var warehouse7 = 0;
				for (var i = 0; i < data.goods.length; i++) {
					switch(data.goods[i].warehouse) {
					    case "1":
					        warehouse1++;
					        break;
					    case "2":
					        warehouse2++;
					        break;
						case "3":
						   warehouse3++;
						   break;
						case "4":
						   warehouse4++;
						   break;
						case "5":
						   warehouse5++;
						   break;
						case "6":
						   warehouse6++;
						   break;
						case "7":
						   warehouse7++;
						   break;
					    default:
					        break;
					}
					$("#huoquNum1").text("货区数："+warehouse1+"个")
					$("#huoquNum2").text("货区数："+warehouse2+"个")
					$("#huoquNum3").text("货区数："+warehouse3+"个")
					$("#huoquNum4").text("货区数："+warehouse4+"个")
					$("#huoquNum5").text("货区数："+warehouse5+"个")
					$("#huoquNum6").text("货区数："+warehouse6+"个")
					$("#huoquNum7").text("货区数："+warehouse7+"个")
				}
*/
			}
		})
	};
});